/**
 * There are <a href="https://github.com/thinkgem/jeesite">JeeSite</a> code generation
 */
package com.chlitina.store.modules.expert.entity;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.validator.constraints.Length;

import com.chlitina.store.common.persistence.BaseEntity;
import com.google.common.collect.Lists;

/**
 * 参数类型Entity
 * @author lvbo
 * @version 2013-06-04
 */
@Entity
@Table(name = "parameter_category")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class ParameterCategory extends BaseEntity {
	
	private static final long serialVersionUID = 1L;
	private Long id; 		// 参数类型编号
	private String name; 	// 参数类型名称

	private List<Parameter> childList = Lists.newArrayList();// 拥有子菜单列表

	public ParameterCategory() {
	}

	public ParameterCategory(Long id){
		this();
		this.id = id;
	}
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Length(min=1, max=32)
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	@OneToMany(cascade={CascadeType.REFRESH, CascadeType.MERGE}, fetch=FetchType.LAZY,mappedBy="parameterCategory")
	@OrderBy(value="id")
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	public List<Parameter> getChildList() {
		return childList;
	}

	public void setChildList(List<Parameter> childList) {
		this.childList = childList;
	}
}
